{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn import datasets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAD8CAYAAACfF6SlAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJztnX+QFOd557/PzDYwi3PMIm0SaawF\nrPjgzGFYayOhUJUyJDGOsdBGv7AiVewqOypfypUCq7ZulXAGdEpEjnKJ3Nm5RL6kEpc4eRFSTSDI\nhc5BrlyRIGvx7hpjiVhIFjCoLGJYfGIH7ezse3/M9NDb8749PTPd79vd83yqKHZnervf/vE+/bzP\nTxJCgGEYhuksUqYHwDAMw+iHhT/DMEwHwsKfYRimA2HhzzAM04Gw8GcYhulAWPgzDMN0ICz8GYZh\nOhAW/gzDMB0IC3+GYZgOpMv0AFTceOONYunSpaaHwTAMEytOnDjxb0KI3kbbRVb4L126FKOjo6aH\nwTAMEyuI6G0/27HZh2EYpgNh4c8wDNOBsPBnGIbpQFj4MwzDdCAs/BmGYToQFv4MwzAdSGRDPRmG\nYYImP1bAniOncWGyiJuzGQxtXI7B/pzpYRmBhT/DMB1BfqyAx144iWKpDAAoTBbx2AsnAaAjXwCB\nmH2I6G+I6F0i+qHi+48T0RUiGq/++0oQx2UYhvHLniOna4LfplgqY8+R04ZGZJagNP+/BfA1AN/0\n2Ob/CiE+HdDxGIZhmuLCZLGpz1slLqalQDR/IcQ/AbgUxL4YhmHC4OZspqnPW8E2LRUmixC4blrK\njxUCO0ZQ6Iz2uZOIJojo20S0U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+CLAL5Y/Z4AfL16/iehiMiL8j8f5/glxz08DuDXwhwPZ/gy\nDMN0IGz2YRiG6UBY+DMMw3QgLPwZhmE6EBb+DMMwHQgLf4ZhmA6EhT/DMEwHwsKfYRimA2HhzzAM\n04H8f3JluV4Pba98AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x21006046cf8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x1, y1 = datasets.make_circles(n_samples=2000, factor=0.5, noise=0.05)\n",
    "x2, y2 = datasets.make_blobs(n_samples=1000, centers=[[1.2,1.2]], cluster_std=[[.1]])\n",
    "\n",
    "x = np.concatenate((x1, x2))\n",
    "plt.scatter(x[:, 0], x[:, 1], marker='o')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from sklearn.cluster import KMeans\n",
    "y_pred = KMeans(n_clusters=3).fit_predict(x)\n",
    "plt.scatter(x[:, 0], x[:, 1], c=y_pred)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from sklearn.cluster import DBSCAN\n",
    "y_pred = DBSCAN().fit_predict(x)\n",
    "plt.scatter(x[:, 0], x[:, 1], c=y_pred)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "y_pred = DBSCAN(eps = 0.2).fit_predict(x)\n",
    "plt.scatter(x[:, 0], x[:, 1], c=y_pred)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "y_pred = DBSCAN(eps = 0.2, min_samples=50).fit_predict(x)\n",
    "plt.scatter(x[:, 0], x[:, 1], c=y_pred)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
